using System;
using System.Collections.Generic;
using System.Text;

namespace GoogleNet
{
    /// <summary>
    /// Specifies the drawing style for all polygons, including polygon extrusions 
    /// (which look like the walls of buildings) and line extrusions (which look like solid fences).
    /// </summary>
    public class KmlPolyStyle : KmlColorStyle, IKmlElement
    {
        private string tagName = "PolyStyle";

        #region Fill
        private bool fill = true;

        /// <summary>
        /// Boolean value (default=1). Specifies whether to fill the polygon. 
        /// </summary>
        /// <value><c>true</c> if fill; otherwise, <c>false</c>.</value>
        public bool Fill
        {
            get { return fill; }
            set { fill = value; }
        } 
        #endregion

        #region Outline
        private bool outline = true;

        /// <summary>
        /// Boolean value (default=1). Specifies whether to outline the polygon. 
        /// Polygon outlines use the current LineStyle. 
        /// </summary>
        /// <value><c>true</c> if outline; otherwise, <c>false</c>.</value>
        public bool Outline
        {
            get { return outline; }
            set { outline = value; }
        }
        #endregion

        #region IKmlElement Members

        /// <summary>
        /// Name of the KML tag for this specific element.
        /// </summary>
        /// <value></value>
        /// <returns></returns>
        public override string TagName
        {
            get { return tagName; }
        }

        #endregion

        #region IKmlGenerator Members

        /// <summary>
        /// Generates the KML for this element including its child elements.
        /// </summary>
        /// <param name="writer">The XML writer that will be used to generate the KML.</param>
        public override void GenerateKml(System.Xml.XmlTextWriter writer)
        {
            writer.WriteStartElement(tagName);
            base.GenerateKml(writer);

            if (!fill)
                writer.WriteElementString("fill", "0");

            if (!outline)
                writer.WriteElementString("outline", "0");

            writer.WriteEndElement();
        }

        #endregion
    }
}
